<div class='fui-page  fui-page-current'>
	<div class='fui-content'>
		<div class="fui-list">
				<div class="fui-list-media" style="margin:0 auto" href="javascript:;" ng-click="access_json('core/member.cavatar/')">
					<img class="round avatar" ng-src="{{pagedata.item.avatar || '../core/resource/images/gw-user.png'}}" />
				</div>
		</div>
		<div class="fui-cell-group">
			<div class="fui-cell must ">
				<div class="fui-cell-label ">社区名称</div>
				<div class="fui-cell-info"><input type="text" class='fui-input' placeholder="专属于你的社区，优先创建优先占有" ng-model="pagedata.item.title" /></div>
			</div>
			<div class="fui-cell must ">
				<div class="fui-cell-label ">联系电话</div>
				<div class="fui-cell-info"><input type="text" class='fui-input' placeholder="请输入联系电话" ng-model="pagedata.item.mobile" /></div>
			</div>
			<!--<div class="fui-cell must ">
				<div class="fui-cell-label ">验证码</div>
				<div class="fui-cell-info"><input type="text" class='fui-input' placeholder="请输入验证码" ng-model="pagedata.item.code" /></div>
			</div>-->
			<div class="fui-cell">
				<div class="fui-cell-label">圈区域</div>
							<div class="fui-cell-label" style="width:28%">
								<select ng-model="pagedata.item.pcd.province" class="form-control tpl-province">
								<option value="" selected="selected">省份</option>
								<option ng-repeat="(value,data) in pagedata.province" value="{{value}}" ng-selected="pagedata.item.pcd.province==value">{{value}}</option>
								</select>
							</div>
							<div class="fui-cell-label" style="width:28%">
								<select ng-model="pagedata.item.pcd.city" class="form-control tpl-city">
								<option value="" selected="selected">城市</option>
								<option ng-repeat="(value,data) in pagedata.province[pagedata.item.pcd.province]" value="{{value}}" ng-selected="pagedata.item.pcd.city==value">{{value}}</option>
								</select>
							</div>
							<div class="fui-cell-label" style="width:28%">
								<select ng-model="pagedata.item.pcd.district" class="form-control tpl-district">
								<option value="" selected="selected">区县</option>
								<option ng-repeat="(value,data) in pagedata.province[pagedata.item.pcd.province][pagedata.item.pcd.city]" value="{{value}}" ng-selected="pagedata.item.pcd.district==value">{{value}}</option>
								</select>
							</div>
							<div class="fui-cell-label" style="width:28%">
								<select ng-model="pagedata.item.pcd.street" class="form-control tpl-district">
								<option value="" selected="selected">街道</option>
								<option ng-repeat="value in pagedata.province[pagedata.item.pcd.province][pagedata.item.pcd.city][pagedata.item.pcd.district]" value="{{value}}" ng-selected="pagedata.item.pcd.street==value">{{value}}</option>
								</select>
							</div>
				
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label ">提货点地址</div>
				<div class="fui-cell-info"><a type="text" class='fui-input' ng-click="tool.choose_location(pagedata.item,'exaddress','exaddress')"><i class="icon icon-map"></i> {{pagedata.item.exaddress.address || pagedata.item.exaddress}}</a></div>
			</div>
			
			<div class="fui-cell">
				<div class="fui-cell-label ">社区简介</div>
				<div class="fui-cell-info"><input type="text" class='fui-input' placeholder="描述社区独特定位和风格，让成员更好的融入" ng-model="pagedata.item.desc" /></div>
			</div>
			
		</div>
		<div class="weui_cells_checkbox" style="margin-top:2rem">
                <div class="fui-cell-label" style="text-align:center;margin:0 auto;padding:0.2rem;font-size:0.56rem">
                    <input type="checkbox" class="fui fui-checkbox fui-checkbox-danger verify-checkbox" style="line-height:0.6rem" ng-checked="pagedata.item.checked==true" ng-model="pagedata.item.checked">
					我已阅读并同意 <a onclick="$('#showsystemcontent').modal();" style="color:#61bba7">《会员协议》</a>
                </div>
        </div>
		<a href='javascript:;' ng-click="post(pagedata.item,'post')" class='btn btn-success block'>确认修改</a>
	</div>
</div>
<div id="showsystemcontent" class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
	<div class="modal-dialog" style="width:96%;left:2%;top:1.5%;">
	<div class="modal-content" style="min-height:500px">
		<div aria-hidden="true" data-dismiss="modal" class="closebtn" style="right:10px;top:0"><i class="icon jinyunicon icon-wrong" style="color:#ccc;"></i></div>
		<div class="fui-article-page">
				<div class="fui-article-title" style="text-align:center">会员协议</div>
				<div class="fui-article-content" ng-bind-html="trust(pagedata.systemxieyi.systemcontent)"></div>
		</div>
	</div>
	</div>
</div>
<script>
window.scope.location(function(re){
	var pcd = scope.pagedata.item.pcd
	scope.pagedata.lat_lng = re.lat_lng
	if(!pcd || pcd =='' || !pcd.province){
		scope.pagedata.item.pcd.province = re.addressComponents.province
		scope.pagedata.item.pcd.city = re.addressComponents.city
		scope.pagedata.item.pcd.district = re.addressComponents.district
		scope.$evalAsync();
	}
});
scope.pagedata.openLocation=function(){
	wx.openLocation({
		latitude: scope.pagedata.lat_lng.lat, // 纬度，浮点数，范围为90 ~ -90
		longitude: scope.pagedata.lat_lng.lng, // 经度，浮点数，范围为180 ~ -180。
		name: scope.pagedata.item.title, // 位置名
		address: '', // 地址详情说明
		scale: 1, // 地图缩放级别,整形值,范围从1~28。默认为最大
		infoUrl: '', // 在查看位置界面底部显示的超链接,可点击跳转
		success:function(){
			//alert(1111);
		}
	});
}
</script>

<script>
window.scope.sendcode=function(){
	var mobile=window.scope.pagedata.item.mobile;
		if(mobile==null){
		alert('请输入手机号！');
		return false;
	}
	if(mobile.length!=11){
		alert('请输入正确的手机号！');
		return false;
	}
	var d=$('#sms_code').text();
	if(d!='重新获取' && d!='获取验证码'){
		return false;
	}
	window.scope.post({'mobile':mobile},'sendcode','',function(res){
		if(res=='success'){
			setTimeout(function(){countdown(59);},1000);
		}else{
			window.scope.message('验证码发送失败！');
		}
	});
}
scope.pagedata.opexaddress=function(){
	scope.tool.choose_location(scope.pagedata.item,'exaddress2','exaddress')
	scope.pagedata.item.exaddress=scope.pagedata.item.exaddress2.address
	scope.$evalAsync();
}
function countdown(start){
		if(start>0){
			$('#sms_code').text(start+'后重新发送');
			start=start-1;
			setTimeout(function(){countdown(start);},1000);
		}else{
			
			$('#sms_code').text('重新获取');
		}
	}
</script>
